//package com.ehome.poct.terminal.controller;
//
//
//import cn.hutool.core.util.ObjectUtil;
//import com.ehome.poct.terminal.api.dto.TermClinicDTO;
//import com.ehome.poct.terminal.api.fegin.TermClinicFeginClient;
//import com.ehome.poct.terminal.api.fegin.TestDeviceFeginClient;
//import com.ehome.poct.terminal.api.vo.DeviceExtInfoVO;
//import com.ehome.poct.terminal.api.vo.TestDeviceVO;
//import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
//import com.github.xiaoymin.knife4j.annotations.ApiSupport;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
//
//@Api(tags = "设备管理")
//@ApiSupport(author = "路飞")
//@RestController
//@RequestMapping("/test_device")
//public class TestDeviceController {
//
//    @Autowired
//    TestDeviceFeginClient testDeviceFeginClient;
//
//    @Autowired
//    TermClinicFeginClient termClinicFeginClient;
//
//    @GetMapping("/{id}")
//    TestDeviceVO getById(@PathVariable(value = "id") String id){
//        return testDeviceFeginClient.getById(id);
//    }
//
//    @ApiOperation("获取设备的额外业务信息")
//    @ApiOperationSupport(author = "cq", order = 1)
//    @GetMapping("/deviceExtInfo")
//    public DeviceExtInfoVO deviceExtInfo(@RequestParam String sno,@RequestParam String projectName){
//        TestDeviceVO bySno = testDeviceFeginClient.getBySno(sno);
//        DeviceExtInfoVO deviceInfo = new DeviceExtInfoVO();
//        if (bySno != null) {
//            if(ObjectUtil.isNotEmpty(bySno.getTermClinicId())){
//                TermClinicDTO termClinicDTO = termClinicFeginClient.getById(bySno.getTermClinicId());
//                List<TestDeviceVO> list = testDeviceFeginClient.listByTermClinicId(bySno.getTermClinicId());
//                if (termClinicDTO != null) {
//                    deviceInfo.setNeedPay(termClinicDTO.getPayType() < 20);
//                }
//                deviceInfo.setOnlineAble(list.size()>1);
//            }
//            deviceInfo.setDeviceSno(sno);
//            deviceInfo.setDeviceVersion("3.1");
//            deviceInfo.setApiUrl("");
//            deviceInfo.setServiceAgreement("http://www.ehomepoct.com/serviceAgreement.html");
//            deviceInfo.setPrivacyStatement("http://www.ehomepoct.com/privacyStatement.html");
//            deviceInfo.setPublicTopic("ehome_public_msg");
//            deviceInfo.setDeviceTopic("ehome_device_mqtt_msg_"+sno);
//            deviceInfo.setClinicTopic("ehome_clinic_mqtt_msg_"+bySno.getTermClinicId());
//            deviceInfo.setMqttUrl("tcp://mqtt.ehomepoct.com:30670");
//            deviceInfo.setApiUrl("https://test-client.ehomepoct.com/");
//            deviceInfo.setUrlName("测试环境API");
//        }
//        return deviceInfo;
//    }
//}
